/*
 * @Author: miaoyongbin
 * @Date: 2022-07-21 10:22:09
 * @LastEditTime: 2022-07-21 10:23:37
 * @Description:
 *
 * Copyright (c) 2022 by miaoyongbin, All Rights Reserved.
 */

import request from '@/utils/request'
import { camelCaseObject } from '@/libs/object'

const AUTH_PREFIX_V1 = `/api/v1/ob`

export function getObClusterList(params) {
  return request.get(`${AUTH_PREFIX_V1}/clusters`, { params }).then(res => camelCaseObject(res))
}

export function getObClusterListByPage(params) {
  return request.get(`${AUTH_PREFIX_V1}/clusters/page`, { params }).then(res => camelCaseObject(res))
}

export function getObCluster(clusterId) {
  return request.get(`${AUTH_PREFIX_V1}/clusters/${clusterId}`).then(res => camelCaseObject(res))
}

export function createObCluster(params) {
  return request.post(`${AUTH_PREFIX_V1}/clusters`, params).then(res => camelCaseObject(res))
}

export function updateObCluster(clusterId, params) {
  return request.put(`${AUTH_PREFIX_V1}/clusters/${clusterId}`, params).then(res => camelCaseObject(res))
}

export function deleteObCluster(clusterId) {
  return request.delete(`${AUTH_PREFIX_V1}/clusters/${clusterId}`).then(res => camelCaseObject(res))
}
